package com.example.userservice.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

// The name "permission-service" would be used for service discovery if using Eureka or Consul
// The url is used for direct communication
@FeignClient(name = "permission-service", url = "${feign.permission-service.url:http://localhost:8082}")
public interface PermissionServiceClient {

    @PostMapping("/api/permission/user/{userId}/bind-role/{roleCode}")
    void bindRole(@PathVariable("userId") Long userId, @PathVariable("roleCode") String roleCode);

    @PostMapping("/api/permission/user/{userId}/bind-default-role")
    void bindDefaultRole(@PathVariable("userId") Long userId);

    @GetMapping("/api/permission/user/{userId}/role-code")
    String getUserRoleCode(@PathVariable("userId") Long userId);

    @PostMapping("/api/permission/user/{userId}/upgrade-to-admin")
    void upgradeToAdmin(@PathVariable("userId") Long userId);

    @PostMapping("/api/permission/user/{userId}/downgrade-to-user")
    void downgradeToUser(@PathVariable("userId") Long userId);
} 